class Event < ActiveRecord::Base
  belongs_to :location
  
  acts_as_ferret :fields => [:title, :details], :additional_fields => [:location_name] #{ :title  => {:store => :yes}, :details => {:store => :yes}}, :additional_fields => { :location_name => {:store => :yes}}

  def location_name
#    my_location = Location.find(location_id)
    return location.title
  end

  def event_date
    start.strftime('%F')
  end
  def event_start_string
#    timenow = DateTime.parse(Time.now.to_s)
    timenow = 5.seconds.ago
    if timenow > self.start and timenow <= self.end
      return 'Now'
    else
      return start.strftime('%l:%M%P')
    end


  end

end
